Skip to content

PowerShell hygiene burndown (#530)#531

Draft
PolyphonyRequiem wants to merge 1 commit into
mainfrom
squad/530-ps-hygiene
Draft

PowerShell hygiene burndown (#530)#531
PolyphonyRequiem wants to merge 1 commit into
mainfrom
squad/530-ps-hygiene

Conversation

@PolyphonyRequiem

Copy link
Copy Markdown
Owner

PowerShell hygiene burndown — issue #530

Implements all three fixes from #530.

Fix 1 — git -C removal (Invoke-PolyphonySdlc.ps1:833)

Replaced the last surviving git -C $mainWorktree remote get-url origin with a Push-Location/Pop-Location-scoped invocation. Matches the cwd-scoped pattern used everywhere else in the launcher.

Fix 2 — $Comment sanitization (Invoke-PolyphonySdlc.ps1:357, 424-456)

Added Get-SanitizedComment helper near the top of the script that strips CR/LF characters and escapes backticks. Applied at the reset-path boundary (immediately after the incompatible-param guard) so all downstream uses — including $resetArgs and the here-string passed to pwsh -Command — receive the sanitized value. Prevents newline injection and backtick injection.

Fix 3 — Retry-with-backoff in worktree teardown (worktree-manager.ps1:254-272)

Backported the delay schedule from GitWorktreeDeleter.cs:RemoveWithRetryAsync (0 ms → 200 ms → 500 ms → 1 000 ms, 4 attempts). Includes the same "already gone = success" short-circuit. Tolerates transient file-handle races on Windows during worktree deletion.


Testing

  • Syntax validation: AST-parsed both .ps1 files via [System.Management.Automation.Language.Parser]::ParseFile — 0 errors in each.
  • Pester suite: Ran .conductor/registry/tests/lint-polyphony.Tests.ps129/29 tests passed.
  • No Pester coverage existed specifically for Invoke-PolyphonySdlc.ps1 or the teardown retry path; tested via AST parse only for those surfaces.

Closes #530

- Invoke-PolyphonySdlc.ps1:833: replaced last surviving `git -C`
  with cwd-scoped invocation (Push-Location/Pop-Location)
- Invoke-PolyphonySdlc.ps1:357,424-456: sanitized $Comment against
  newline + backtick injection in the reset path via Get-SanitizedComment
- worktree-manager.ps1:254-272: backported retry-with-backoff from
  src/Polyphony/Journal/Reset/Deleters/GitWorktreeDeleter.cs:37-64

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PolyphonyRequiem PolyphonyRequiem added the squad:liszt Owner: Liszt (PowerShell) label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squad:liszt Owner: Liszt (PowerShell)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerShell hygiene burndown: kill git -C, sanitize $Comment, backport retry-with-backoff

1 participant